<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<!doctype html>
<html>
<head lang="en">
<title>幼儿监护系统</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed"
	href="assets/i/app-icon72x72@2x.png">
<link rel="stylesheet" href="/yejhxt/assets/css/amazeui.min.css" />
<link rel="stylesheet" href="/yejhxt/assets/css/admin.css">
<link rel="stylesheet" href="/yejhxt/assets/css/custom.css" />
<link rel="stylesheet"
	href="/yejhxt/assets/css/amazeui.datetimepicker.css" />



<script src="/yejhxt/assets/js/jquery.min.js"></script>
<script src="/yejhxt/assets/js/js.KinerCode.js"></script>
<script src="/yejhxt/assets/js/custom.js"></script>
<script src="/yejhxt/assets/js/amazeui.min.js"></script>
<script src="/yejhxt/assets/js/amazeui.datetimepicker.js"></script>

<style type="text/css">
.user{
	cursor: pointer;
	background-color: #FFFFFF;
}
</style>
</head>

<body>
	<%@ include file="../commoms/sysHead.txt"%>

	<div class="admin-content">
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">表格</strong> / <small>Table</small>
				</div>
			</div>

			<hr>


			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>

									<th class="table-id">ID</th>
									<th class="table-title">真实姓名</th>
									<th class="table-author am-hide-sm-only">性别</th>

									<th class="table-date am-hide-sm-only">公司</th>
									<th class="table-set">职业</th>
									<th class="table-set">email</th>
									<th class="table-author am-hide-sm-only">联系电话</th>
									<th class="table-set">QQ</th>
									<th class="table-set">家庭住址</th>
								</tr>
							</thead>

							<tbody id="pagecontainer">

							</tbody>
						</table>

						<hr />
					</form>
				</div>

			</div>
		</div>

	</div>
	<div class="am-popup" id="my-popup">
		<div class="am-popup-inner">
			<div class="am-popup-hd">
				<h4 class="am-popup-title">设备信息</h4>

				<span data-am-modal-close class="am-close">&times;</span>
			</div>
			<div class="am-popup-bd">
			 
			 
			 <div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
	
									<th class="table-id">ID</th>
									<th class="table-title">设备名</th>
									<th class="table-author am-hide-sm-only">设备ID</th>
									<th class="table-author am-hide-sm-only">持有人</th>
									<th class="table-date am-hide-sm-only">关联时间</th>
									<th class="table-set">操作</th>
								</tr>
							</thead>

							<tbody id="devicecontainer">

							</tbody>
						</table>
				
						<hr />
					</form>
				</div>

			</div>
			 
			 
			</div>
		</div>
	</div>

	</div>
	<a href="#"
		class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
		data-am-offcanvas="{target: '#admin-offcanvas'}"></a>


	<script type="text/javascript">
		var currentpage = 1;
		var pages = 1;
		var $pagecontainer = $('#pagecontainer');
		var ldata = null;
		var alldata = null;
		var nums = 0;
		getdiffstatuscontent("/yejhxt/api/sysuser/getAlluser.do", {},
				$pagecontainer);

		$pagecontainer.on('click', '.user', function(event) {
			var pid = event.currentTarget.id;
			var index = pid.replace('user', "");
			if (event.target.nodeName != 'BUTTON'
					&& event.target.nodeName != 'INPUT') {
				var data=ldata[index].device;
				$.each(data,function(i, item) {
					$('#devicecontainer')
							.append(' <tr class="dev" id=dev'
							+ i + '><td>'+(i+1)+'</td><td>'
									+ item.devicename
									+ '</td><td>'
									+ item.devicecode
									+ '</td><td>'
									+ item.holder

									+ '</td><td>'
									+ item.createtime
									+ '</td><td>'
                                    +'<div class="am-btn-toolbar"><div class="am-btn-group am-btn-group-xs">'
									+ ' <button id=look'
									+ item.devicecode
									+ ' class=" look am-btn am-btn-default am-btn-xs am-hide-sm-only"><span class="am-icon-pencil-square-o"></span> 查看</button>'
																			

																				+ ' </div> </div>'

									+ '</td></tr>');

				});
				$('#my-popup').modal("toggle");
			}
		});

	
		$('#devicecontainer').on('click', '.look', function(event) {
			var index = event.currentTarget.id.replace("look", "");
                     
		
			myPost('/yejhxt/sysmanager/viewdevice.jsp',{'devicecode':index});
			window.event.returnValue = false;
		
		});
		
		
		function getdiffstatuscontent(url, parameters, $pagecontainer) {

			myAjax(url, parameters, function(data) {
				alldata = data;
				ldata=alldata.result;
				drawDiffStatusContent($pagecontainer, ldata);

			});

		}
		function drawDiffStatusContent($pagecontainer, data) {

			$.each(data,function(i, item) {
								$pagecontainer
										.append(' <tr class="user" id=user'
										+ i + '><td>'+(i+1)+'</td><td>'
												+ item.realname
												+ '</td><td>'
												+ item.gender
												+ '</td><td>'
												+ item.company

												+ '</td><td>'
												+ item.occupation
												+ '</td> <td>'
												+ item.email
												+ '</td><td>'
												+ item.phone
												+ '</td><td>'
												+ item.qq
												+ '</td><td>'
												+ item.address
												+ '</td></tr>');

							});

		}
	</script>

</body>
</html>
